package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConAnnouncementFeedback;
import com.htgd.gardenexpo.dao.GeConAnnouncementFeedbackDao;
import com.htgd.gardenexpo.service.GeConAnnouncementFeedbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConAnnouncementFeedback)表服务实现类
 *
 * @author makejava
 * @since 2021-06-09 15:43:52
 */
@Service("geConAnnouncementFeedbackService")
public class GeConAnnouncementFeedbackServiceImpl implements GeConAnnouncementFeedbackService {
    @Resource
    private GeConAnnouncementFeedbackDao geConAnnouncementFeedbackDao;

    /**
     * 通过ID查询单条数据
     *
     * @param 主键
     * @return 实例对象
     */
    @Override
    public GeConAnnouncementFeedback queryById() {
        return this.geConAnnouncementFeedbackDao.queryById();
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConAnnouncementFeedback> queryAllByLimit(int offset, int limit) {
        return this.geConAnnouncementFeedbackDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConAnnouncementFeedback> getinfoByAnnouncementId(int id) {
        return this.geConAnnouncementFeedbackDao.getinfoByAnnouncementId(id);
    }

    /**
     * 新增数据
     *
     * @param geConAnnouncementFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConAnnouncementFeedback insert(GeConAnnouncementFeedback geConAnnouncementFeedback) {
        this.geConAnnouncementFeedbackDao.insert(geConAnnouncementFeedback);
        return geConAnnouncementFeedback;
    }

    /**
     * 修改数据
     *
     * @param geConAnnouncementFeedback 实例对象
     * @return 实例对象
     */
    @Override
    public GeConAnnouncementFeedback update(GeConAnnouncementFeedback geConAnnouncementFeedback) {
        this.geConAnnouncementFeedbackDao.update(geConAnnouncementFeedback);
        return this.queryById();
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById() {
        return this.geConAnnouncementFeedbackDao.deleteById() > 0;
    }
    @Override
    public boolean deleteByAnnouncementId(int id) {
        return this.geConAnnouncementFeedbackDao.deleteByAnnouncementId(id) > 0;
    }
}
